package com.heima.model.common.pojos.search;

import com.heima.model.common.dtos.ArticleDto;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
public class SearchArticleDoc {

    // 文章id
    private Long id;
    // 文章标题
    private String title;
    // 文章发布时间
    private Date publishTime;
    // 文章布局
    private Integer layout;
    // 封面
    private String images;
    // 作者id
    private Long authorId;
    // 作者名词
    private String authorName;
    //静态url
    private String staticUrl;
    //文章内容
    private String content;

    public SearchArticleDoc(ArticleDto articleDto) {
        this.id = articleDto.getId();
        this.title = articleDto.getTitle();
        this.publishTime = articleDto.getPublishTime();
        this.layout = (int)articleDto.getLayout();
        this.images = articleDto.getImages();
        this.authorId = articleDto.getAuthorId();
        this.authorName = articleDto.getAuthorName();
        this.staticUrl = articleDto.getStaticUrl();
        this.content = articleDto.getContent();
    }
}